<template>
	<view>
		<view class="top-view">
			<image class="img" mode="aspectFill" :src="detailData.picShowUrl"></image>
			<view class="right">
				<view class="name">{{detailData.name}}</view>
				<view class="money">￥{{detailData.price}}/月</view>
				<view class="pay-type">上门支付</view>
			</view>
		</view>
		<view class="num-row">
			<view class="title">数量</view>
			<view>
				<uni-number-box min="1" v-model="form.num"></uni-number-box>
			</view>
		</view>
		
		<view class="form-view">
			<view class="form-row">
				<view class="label require">姓名</view>
				<input 
					placeholder="请输入姓名" 
					placeholder-class="placeholder-class"/>
			</view>
			<view class="form-row">
				<view class="label require">手机</view>
				<input 
					placeholder="请输入手机号码" 
					placeholder-class="placeholder-class"/>
			</view>
			<view class="form-row">
				<view class="label require">地址</view>
				<input 
					placeholder="请输入地址" 
					placeholder-class="placeholder-class"/>
			</view>
			<view class="form-row">
				<view class="label">买家留言</view>
				<textarea
					placeholder="请输入买家留言" 
					placeholder-class="placeholder-class"/>
			</view>
		</view>
		
		<view class="fixed-view">
			<view class="money">￥{{totalPrice}}</view>
			<view class="btn">提交订单</view>
		</view>
	</view>
</template>

<script>
	import * as assistDev from '../../common/api/assistDev.js'
	export default {
		data() {
			return {
				uid:'',
				detailData:{},
				form:{
					num:1
				}
			}
		},
		onLoad(opt) {
			if(opt.uid){
				this.uid = opt.uid
			}
		},
		onShow() {
			this.getData()
		},
		computed:{
			totalPrice(){
				return this.detailData.price * this.form.num
			}
		},
		methods: {
			getData(){
				const param = {
					uid:this.uid
				}
				assistDev.queryByUid(param).then(result => {
					this.detailData = result.data.data || {}
				}).catch(error => {
					console.log(error);
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
.top-view{
	width: 100%;
	display: flex;
	box-sizing: border-box;
	padding: 30rpx;
	.img{
		width: 180rpx;
		height: 180rpx;
	}
	.right{
		display: flex;
		flex-direction: column;
		margin-left: 30rpx;
		.name{
			
		}
		.money{
			color: #47D1D1;
			font-size: 30rpx;
			font-weight: bold;
			margin-top: 10rpx;
			margin-bottom: 10rpx;
		}
		.pay-type{
		}
	}
}

.num-row{
	width: 100%;
	display: flex;
	box-sizing: border-box;
	padding: 30rpx;
	.title{
		flex: 1;
	}
}


.form-view{
	width: 100%;
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
	padding: 30rpx;
	.form-row{
		border-bottom: solid 1rpx rgba(215, 215, 215,0.5);
		margin-bottom: 20rpx;
		.label{
			font-size: 26rpx;
		}
		.require::before{
			content: '*';
			color: red;
			margin-right: 5rpx;
		}
		.placeholder-class{
			font-size: 26rpx;
		}
		input{
			margin-top: 10rpx;
			margin-bottom: 10rpx;
			width: 100%;
		}
		textarea{
			margin-top: 10rpx;
			margin-bottom: 10rpx;
			width: 100%;
		}
	}
}

.fixed-view{
	position: fixed;
	bottom: 0;
	width: 100%;
	padding: 10rpx 30rpx;
	box-sizing: border-box;
	display: flex;
	align-items: center;
	border-top: solid 1rpx rgba(214, 214, 214,0.6);
	background: white;
	.money{
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		box-sizing: border-box;
		padding: 10rpx;
		color: #47D1D1;
		font-size: 30rpx;
		font-weight: bold;
	}
	.btn{
		flex: 1;
		background: #F05F10;
		height: 80rpx;
		border-radius: 40rpx;
		color: white;
		display: flex;
		align-items: center;
		justify-content: center;
		margin-left: 20rpx;
	}
}
</style>
